<?php
/**
 * Created by PhpStorm.
 * User: zhang
 * Date: 2016/3/9
 * Time: 23:20
 */
namespace Chealth\Model;
use Think\Model;
class ChealthNoticesModel extends Model{

    protected $_auto = array(
        array('create_time','time',1,'function'),
        array('update_time','time',2,'function'),
    );

    public function updateNotice(){
        if($this->create()){
            if(empty($this->data['id'])){
                $result = $this->add();
            }else{
                $result = $this->save();
            }
            if($result === false){
                $this->error = '保存失败,请重试';
                return false;
            }
            return true;
        }else{
            return false;
        }
    }
}